#include "FontResource.h"

using namespace SolidityEngine;

FontResource::FontResource(const std::string& path, const std::string& name):
    Resource(path,name),
    Font()
{
    //ctor
}

FontResource::~FontResource()
{
}

void FontResource::Load()
{
    _font=TTF_OpenFont(path.c_str(),25);
    if(!_font){
        throw (" Error: Could not load font!");
    };
    count++;
}

void FontResource::UnLoad()
{
    count--;
    if(count<1){
        TTF_CloseFont(_font);
        _font=NULL;
    }
}

FontResource* FontResource::_Clone()
{
    return new FontResource(*this);
}
